package com.hmall.user.service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hmall.user.filter.ThreadLocalUtil;
import com.hmall.user.mapper.AddressMapper;
import com.hmall.user.pojo.Address;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AddressServiceImpl extends ServiceImpl<AddressMapper, Address> implements AddressService {

    @Autowired
    AddressMapper addressMapper;

    @Override
    public List<Address> getAddressByUserId() {
        Long userId = ThreadLocalUtil.getUserId();
        userId = 2L;
        return addressMapper.getAddressByUserId(userId);
    }

    @Override
    public Address getAddressById(Long addressId) {
        return addressMapper.selectById(addressId);
    }
}
